<?php
if(isset($_REQUEST['user']) AND isset($_REQUEST['sess']))
{
	session_destroy();
	session_start();
	$user = $_REQUEST['user'];
	$sess = $_REQUEST['sess'];
	$sesstime = time() + (60 * 60 * 24 * 7);
	$_SESSION["suser"] = $user;
	$_SESSION["ssess"] = $sess;
	if(isset($_COOKIE['cuser']))
	{
		unset($_COOKIE['cuser']);
		setcookie("cuser", $user, 1, "/");
	}
	setcookie("cuser", $user, $sesstime, "/");
	if(isset($_COOKIE['csess']))
	{
		unset($_COOKIE['csess']);
		setcookie("csess", $sess, 1, "/");
	}
	setcookie("csess", $sess, $sesstime, "/");
	header("location:index.php");
}
?>